package com.zsc.edu.gateway.modules.iot.tsl.repo;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zsc.edu.gateway.modules.iot.tsl.entity.Event;
import com.zsc.edu.gateway.modules.iot.tsl.query.EventQuery;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Optional;

/**
 * @author Yao
 */
public interface EventRepository extends BaseMapper<Event> {
    @Select("select * from iot_event where name=#{name}")
    Event findByName(String name);

//    List<Event> findByProductId(Long productId);

//    IPage<Event> page(Page<Event> page, @Param("query") EventQuery query);

    Event selectById(@Param("id") Long id);

    List<Event> selectByProductId(@Param("productId") Long id, @Param("enabled") Boolean enabled);
}
